﻿Public Class frmTraCuuTheoThoiGian

    Private Sub btnTHOAT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTHOAT.Click
        Me.Close()
    End Sub

    Private Sub btnTIM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTIM.Click
        Dim _ngayDay As String = dtpNGAYDAY.Text
        Dim _gioDay As String = dtpGIODAY.Text

        Dim _strWhere As String = String.Empty

        If Not String.IsNullOrEmpty(_ngayDay) Then
            _strWhere += " PC.NgayDay like " & _ngayDay
        End If

        If Not String.IsNullOrEmpty(_gioDay) Then
            If Not String.IsNullOrEmpty(_strWhere) Then
                _strWhere += " and "
            End If
            _strWhere += " PC.GioDay like " & _gioDay
        End If

        'If Not String.IsNullOrEmpty(_maCM) Then
        '    _strWhere += " CM.MaChuyenMon like " & _maCM
        'End If

        If Not String.IsNullOrEmpty(_strWhere) Then
            _strWhere = " and " & _strWhere
        End If

        Dim strSQL As String = "select GV.MaGV, GV.HoTen, PH.TenPhong, LH.TenLop, CM.TenChuyenMon from GIAOVIEN GV, LOPHOC LH, PHONGHOC PH, PHANCONG PC, CHUYENMON CM where GV.MaChuyenMon=CM.MaChuyenMon and GV.MaGV=PC.MaGV and PH.MaPhong=PC.MaPhong and PC.MaLop=LH.MaLop" & _strWhere
        Dim _tc As DataTable
        _tc = PhanCongDAO.SelectByGV(strSQL)
        dgvTCTheoTT.DataSource = _tc
    End Sub
End Class